/**
 * 系统设置控制器
 */
import $_fn from '~plugins'
export default ['$scope','$rootScope','$location','$ui','http','$state',function($scope,$rootScope,$location,$ui,http,$state) {
    $scope.tabMenu = $_fn.getCurrMenu($location.path())
    console.log($location.path())

    //分页参数
    $scope.page = {
      current:  1
    }
    //获取数据的入参
    $scope.params = {
      
    }
    $scope.getDada = function(page,params){
        params.pageNum = page
        http.post('selectSystemLog.do',params,function (data) {
          var _data = data.data
          $scope.page.pageNum =  $scope.page.current
          $scope.page.pageSize = _data.pageSize
          $scope.page.total = _data.total
          if(data.errcode > 0){
            //列表无数据
            $scope.$apply(function () {
              if(_data.list.length == 0){
                $scope.isData = true
              }else {
                $scope.isData = false
                $scope.dataList = _data.list
              }
            })
          }
        },function(){
          //报错时
          $scope.isData = true
          $scope.dataList = []
        })
    }
    //提示错误
    $scope.errorToast = function(text) {
        $ui.toast({text:text,type:'warning',position:'center',appendTo:'.main-content'});
    }
    //初始化数据
    $scope.getDada(1,$scope.params)
}]
